@charset 'UTF-8';

@import '~/scss/themes/index.scss';
@import '~/scss/helpers/_text.scss';

/*******************************
          表单
*******************************/

.form-control {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: center;
  .control-container {
    display: inline;
    margin: 0 3px 0 0;
  }
  .control-btn {
    vertical-align: top;
    height: 28px;
    line-height: 28px;
    cursor: pointer;
    font-size: 16px;
    flex: 0 0 28px;
    display: inline-block;
    width: 28px;
    height: 28px;
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);

    &.is-hover {
      display: none;
    }
  }

  &:hover {
    .control-btn.is-hover {
      display: inline-block;
    }
  }
}

.g2-form {
  .form-input--title,
  .form-input {
    .el-input__inner,
    .el-textarea__inner {
      // border: none;
      background: transparent;
      transition: background 0.5s ease-in-out;
    }

    &:hover .el-input__inner,
    &:hover .el-textarea__inner {
      background: transparent;
      transition: background 0.5s ease-in-out;
    }
  }

  .form-panel {
    border: 1px solid #dfdfdf;
    border-radius: 5px 5px 0 0;
    width: 100%;
    background-color: #fff;

    margin-top: 12px;

    &:first-child {
      margin-top: 0;
    }

    .form-panel-head {
      padding: 12px 15px;
      background-color: #f5f5f5;
      border-top-left-radius: $border-radius-base;
      border-top-right-radius: $border-radius-base;
      border-bottom: $base--border;
      @include header-h5();
    }

    .g2-row {
      position: relative;
      min-height: 35px;
      border-bottom: 1px solid #dfdfdf;
      display: flex;
      flex-direction: row;
      align-items: center;

      &:first-child {
        border-top-left-radius: $border-radius-base;
        border-top-right-radius: $border-radius-base;
        .column-two:first-child {
          .el-input__inner {
            border-top-left-radius: $border-radius-base;
          }
        }
        .column-two:last-child {
          border-top-right-radius: $border-radius-base;
        }
      }
      &:last-child {
        border-bottom-left-radius: $border-radius-base;
        border-bottom-right-radius: $border-radius-base;
        border-bottom: none;
        .column-two:first-child {
          border-bottom-left-radius: $border-radius-base;
        }
        .column-two:last-child {
          border-bottom-right-radius: $border-radius-base;
        }
      }
      .g2-column {
        flex: 0 0 100%;
        width: 100%;
        min-height: 35px;
        &.column-two {
          flex: 0 0 50%;
          width: 50%;
          height: 35px;
          &:first-child {
            border-right: $base--border;
          }
        }
      }
    }
    .el-form-item {
      margin-bottom: 0;
      .g2-form-item__content--span {
        width: 100%;
        padding-left: 15px;
        color: #606266;
        @include utils-ellipsis();
      }
      &.is-normal {
        .el-form-item__content {
          white-space: normal;
          .g2-form-item__content--span {
            white-space: normal;
          }
        }
      }

    }

    .el-form-item__content {
      @include utils-ellipsis();
    }
    .el-form-item__label {
      position: absolute;
      background-color: #f5f5f5;
      line-height: 35px;
      font-size: 12px;
      height: 100%;
      border-right: 1px solid #dfdfdf;
    }

    // 处理input的边框
    .el-input__inner,
    .el-textarea__inner {
      border-color: transparent;
      border-radius: 0;
      line-height: 35px;
      height: 35px;
      width: 100%;
    }
    .el-textarea__inner {
      line-height: 20px;
    }

    // 处理switch
    .el-switch {
      padding-left: 15px;
    }

    .el-form-item__error {
      z-index: 1;
    }

    .el-form-item__error--inline{
      position: absolute;
      top: 100%;
      left: 0;
      height: 24px;
      z-index: 1;
    }
  }
}

.form-title {
  display: flex;
  flex-direction: row;
}

.g2-form-detail {
  border-radius: 3px;
  border: 1px solid #e5e5e5;
  background-color: #fff;
  margin: 0 0 13px;
  padding-top: 18px;
  .control-group {
    padding: 6px 20px;
    &:hover {
      background: #f5f5f5;
    }
    .el-form-item__label {
      float: left;
      line-height: 30px;
      color: #999;
      white-space: nowrap;
      width: 64px;
      margin: 0;
      padding-top: 0;
      text-align: left;
      font-size: 12px;
      font-weight: bold;
    }
    .el-form-item__content {
      position: relative;
      @include utils-ellipsis();
    }
  }
}
